<template>
  <div id="AsnDetail">
    <div class="detail">
      <component :inputData="detailData" :is="currentComponent"></component>
    </div>
  </div>
</template>

<script>
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "AsnDetail",
  mixins: [baseMixin],
  data() {
    return {
      newFlag: false,
      selectData: {},
      detailData: {
        loc: "",
        locationtype: "0",
        locationcategory: "OTHER",
        locationhandling: "9",
        abc: "0",
        section: "",
        locationflag: "NONE",
        status: "OK",
        putawayzone: "DOCK",
        logicallocation: "",
        interleavingsequence: "",
        comminglesku: "1",
        comminglelot: "1",
        height: "0",
        length: "0",
        width: "0",
        loclevel: "0",
        xcoord: "0",
        ycoord: "0",
        zcoord: "0",
        orientation: "",
        autoship: 0,
        loseid: 0,
        cubiccapacity: 0,
        weightcapacity: 0,
        stacklimit: "0",
        footprint: "0",
        cube: 0,
        pickzone: " ",
        sectionkey: " "
      },
      detailNav: "1",
      componentConfig: [
        {
          name: "ZoneDetails",
          label: this.$t('bill.detail'),
          component: () => import('./page/particulars.vue')
        }
      ]
    }
  },
  computed: {
    currentComponent() {
      return this.componentConfig[this.detailNav - 1].component;
    }
  },
  methods: {
    async getData() {
      try {
        let res = await this.$api.get(`/queryLocByLocKey/${this.selectData.loc}`);
        
          this.detailData = res.bean;
      } catch (e) {
        this.$message.error(e);
      }
    },
  },
  mounted() {
    this.newFlag = this.$store.state.newFlag;
    if (Object.keys(this.$store.state.skip).length !== 0) {
      let data = this.$store.state.skip;
      this.detailData = data.detail;
      this.selectData = data.routeData;
      this.detailNav = data.detailNav;
    } else if (!this.newFlag) {
      this.selectData = this.$store.state.routeData;
      this.getData();
    }


  },
  watch: {},
  components: {},
}
</script>

<style scoped>

</style>
